package myhomework;

import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Work4 {
    public static void main(String[] args) {
        int[] score = new int[10];
        Scanner scanner = new Scanner(System.in);
        int i;
        for (i = 0; i < 10; i++) {
            score[i]=scanner.nextInt();
        }
        int max = getMax(score);
        int min = getMin(score);
        int average=getAverage(score,max,min);
        System.out.println(max);
        System.out.println(min);
        System.out.println(average);

    }

    public static int getMax(int[] score) {
        int max=score[0];
        for (int i : score) {
            if(i>max){
                max=i;
            }
        }
        return max;
    }

    public static int getMin(int[] score) {
        int min=score[0];
        for (int i : score) {
            if(i<min){
                min=i;
            }

        }
        return min;
    }

    public static int getAverage(int[] score,int max,int min) {
        int sum = Arrays.stream(score).sum()-max-min;
        int average=sum/8;
        return average;
    }


}
